# coding: utf-8
from qfluentwidgets import MessageBoxBase, TextBrowser, SubtitleLabel


class TextDialog(MessageBoxBase):
    def __init__(self, title: str = "Text Dialog", parent=None):
        super().__init__(parent)
        self.titleLabel = SubtitleLabel(title, self)
        self.textBrowser = TextBrowser(self)

        self._hBoxLayout.removeWidget(self.widget)
        self._hBoxLayout.setContentsMargins(100, 100, 100, 100)
        self._hBoxLayout.addWidget(self.widget)

        self.viewLayout.addWidget(self.titleLabel)
        self.viewLayout.addWidget(self.textBrowser)

    def setTitle(self, title: str):
        self.titleLabel.setText(title)

    def setText(self, text: str):
        self.textBrowser.setText(text)
